//
// Created by yephiu on 2023/7/7.
//

#ifndef FLIGHT_CLION_NIZHOU_DRV_T265_H
#define FLIGHT_CLION_NIZHOU_DRV_T265_H

#include "stm32f4xx_hal.h"

typedef enum
{
    T265_OFFLINE=0,
    T265_READY,
    T265_TESTING
}T265_Status;

typedef struct
{
    uint8_t frame_type;
    uint8_t data_length;
    float float_data[4];
    uint8_t checksum;
} T265_DataPacket;

typedef enum
{
    T265_WAIT_HEADER,
    T265_WAIT_TYPE,
    T265_WAIT_LENGTH,
    T265_WAIT_FLOAT_DATA,
    T265_WAIT_CHECKSUM,
    T265_WAIT_TAIL
} T265_ParserState;

typedef struct
{
    float qx;
    float qy;
    float qz;
    float qw;

    float px;
    float py;
    float pz;

    float vx;
    float vy;
    float vz;

    float ax;
    float ay;
    float az;
}T265_data_t;

typedef struct
{
    float PX;//机体坐标系前后方向，向前为正
    float PY;//机体坐标系左右方向，向左为正
    float PZ;//机体坐标系竖直方向，朝天为正

    float VX;//机体坐标系前后方向，向前为正
    float VY;//机体坐标系左右方向，向左为正
    float VZ;//机体坐标系竖直方向，朝天为正

    float AX;//机体坐标系前后方向，向前为正
    float AY;//机体坐标系左右方向，向左为正
    float AZ;//机体坐标系竖直方向，朝天为正
}T265_flight_dir_t;//机体坐标系方向
/*
 *    +x
 * +y 机
 *
 */


extern T265_flight_dir_t T265_flight_dir;

uint8_t T265_Init(void);
void T265_DataAnlTask(uint8_t received_byte);
void T265_DataUpdateTask(uint8_t dT_ms);





#endif //FLIGHT_CLION_NIZHOU_DRV_T265_H
